package analysis.bean.value;

import common.KPIType;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.WritableUtils;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MapWritableValue extends StatsOutputValue{
    private MapWritable value = new MapWritable();
    private KPIType kpi;

    @Override
    public void write(DataOutput out) throws IOException {
        this.value.write(out);
        WritableUtils.writeEnum(out, kpi);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        this.value.readFields(in);
        WritableUtils.readEnum(in, KPIType.class);
    }

    public MapWritable getValue() {
        return value;
    }

    public void setValue(MapWritable value) {
        this.value = value;
    }

    @Override
    public KPIType getKPI() {
        return this.kpi;
    }

    public void setKpi(KPIType kpi) {
        this.kpi = kpi;
    }
}
